package com.zjs.mq.kafka;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description Kafka控制层
 * @Author zhu_jinsheng[zhu_js@suixingpay.com]
 * @Date 2020/2/25 15:35
 * @Version 1.0
 */
@Controller
@RequestMapping("/kafka")
public class KafkaController {

    @Autowired
    private KafkaProducer producer;

    @GetMapping("/send")
    @ResponseBody
    public String sendMessage(){
        try {
            producer.send();
            return "发送成功";
        } catch (Exception e) {
            return "发送异常";
        }
    }
}
